<script lang="javascript">
	import { GET_PERMI } from '@/utils/Const';
	import { useFactoryStore } from '@/hooks/useFactoryStore';
	import { h } from 'vue';

	export default {
		props : {
			permi : {
				type : Array,
				default : () => []
			}
		},
		setup (props, context) {
			const { getter } = useFactoryStore({
				namespaced : 'permission',
				gettersMethod : [GET_PERMI]
			});
			return () => {
				if (props.permi.length === 0) {
					return h(context.slots.default);
				}
				return getter[GET_PERMI].value.some(v => props.permi.includes(v)) ? h(context.slots.default) : null;
			};
		}
	};
</script>
